<html>
<head><meta charset="utf-8"><title>asm syntax · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/asm.20syntax.html">asm syntax</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208024541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/asm%20syntax/near/208024541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> joey <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/asm.20syntax.html#208024541">(Aug 25 2020 at 21:15)</a>:</h4>
<p>Hi,</p>
<div class="codehilite"><pre><span></span><code>fn bar(ptr: *mut u64) -&gt; u64 {
  let v;
  unsafe {
    asm!(
     &quot;mov {bar}, {foo}&quot;,
     foo = in(reg) *ptr,
     bar = out(reg) v,
    )
  }
  v
}
</code></pre></div>


<p>Is the above syntax correct? Trying to get used to the new <code>asm!()</code></p>



<a name="208028631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/asm%20syntax/near/208028631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/asm.20syntax.html#208028631">(Aug 25 2020 at 21:50)</a>:</h4>
<p>Looks correct to me.</p>



<a name="208050452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/asm%20syntax/near/208050452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/asm.20syntax.html#208050452">(Aug 26 2020 at 03:47)</a>:</h4>
<p>You could also pass in the pointer and load from it.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>